package com.xlabs.client;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.xlabs.client.DTO.TransferDTO;

/**
 * TimedCommentServiceAsync interface.
 */
public interface CommentingServiceAsync {

    /**
     * Posts comment for a video.
     *
     * @param comment        comment text.
     * @param time           time of comment.
     * @param currentVideoId video id.
     */
    void postQuestion(String comment, int time, String currentVideoId, AsyncCallback async);

    /**
     * Posts a reply for a question.
     *
     * @param reply       reply.
     * @param questionKey question key.
     * @return updated comments.
     */
    void postReply(String reply, String questionKey, AsyncCallback async);

    /**
     * Posts an inner reply for another reply in conversation.
     *
     * @param reply              reply.
     * @param parentReplyKey     question key.
     * @param questionEncodedKey corresponding question's encoded key
     */
    void posInnertReply(String reply, String parentReplyKey, String questionEncodedKey, AsyncCallback async);

	/**
	 * Gets questions asked around the given time.
	 * @param videoId video id.
	 * @param time input time.
	 * @param pageSize how many questions to return. 
	 * @param asyncCallBack callback method.
	 */
    void getPagedQuestionsWithStartTimeAroundTime(
			String videoId, 
			int time,
			int pageSize,
			AsyncCallback<TransferDTO> asyncCallBack);

	/**
	 * Gets a question responses according to the given index and range. 
	 * @param questionEncodedKey Question key. 
	 * @param startIndexInc start Index.
	 * @param endIndexExcl end index. 
	 * @param direction query direction (left or right). 
	 * @param pageSize page size. 
	 * @param callback call back.
	 */
    void getQuestionResponsesByIndex(
			String questionEncodedKey, 
			String startIndexInc,
			String endIndexExcl, 
			int direction, 
			int pageSize,
			AsyncCallback<TransferDTO> callback);
    
	/**
	 * Gets a response's responses according to the given index and range. 
	 * @param parentReplyEncodedKey response key. 
	 * @param startIndexInc start Index.
	 * @param endIndexExcl end index. 
	 * @param direction query direction (left or right). 
	 * @param pageSize page size. 
	 * @param callback call back.
	 */
    void getInnerRepliesByIndex(
			String parentReplyEncodedKey, 
			String startIndexInc,
			String endIndexExcl, 
			int direction, 
			int pageSize,
			AsyncCallback<TransferDTO> callback);

    /**
     * Sets a reply as an answer or nonanswer to a question. 
     * @param questionKey The question encoded key.
     * @param replyKey The relpy encoded key.
     * @param isAnswer whether to set the reply as an answer (or non-answer).
     * @param callback The client call back.
     */
    void setReplyAsAnswer(
    		String questionKey, 
    		String replyKey,
			boolean isAnswer, 
			AsyncCallback<TransferDTO> callback);
}